﻿using System;
using System.Data.SqlClient;

namespace Mysoft.Dbf
{

    public class K3104
    {
        //public static K3104 New(SqlDataReader reader)
        //{
        //     K3104 k3 = new K3104(reader);
        //    return k3;
        //}

        public K3104(SqlDataReader reader){
//             strSQL = "SELECT FDATE,0" & _
//"FTRANSDATE 1,FPERIOD 2,FGROUP 3,FNUM,FENTRYID 5,FEXP 6,FACCTID,FCLSNAME1 8,FOBJID1,FOBJNAME1,FCLSNAME2 11,FOBJID2,FOBJNAME2," & _
//"FCLSNAME3 14, FOBJID3,FOBJNAME3,FCLSNAME4,FOBJID4,FOBJNAME4 19,FCLSNAME5,FOBJID5,FOBJNAME5,FCLSNAME6,FOBJID6," & _
//"FOBJNAME6,FCLSNAME7,FOBJID7,FOBJNAME7 28,FCLSNAME8,FOBJID8,FOBJNAME8,FTRANSID 32,FCYID,FEXCHRATE,FDC 35," & _
//"FFCYAMT,FQTY,FPRICE,FDEBIT,FCREDIT 40,FSETTLCODE,FSETTLENO,FPREPARE 43,FPOSTER,FCHECKER,FATTCHMENT 46," & _
//"FPOSTED,FMODULE,FDELETED, FSERIALNO " & _
// "FROM vp_CwjkVoucher WHERE " & sFilter & " AND BUGUID='" & Session("BUGUID") & "' AND CwztGUID='" & sCwztGUID & "' AND IsExport=0 ORDER BY FNUM,FENTRYID"
//                strSQL = "SELECT ISNULL(FDATE,'1900-01-01')," & _
//"ISNULL(FTRANSDATE,'1900-01-01'),ISNULL(FPERIOD,0),ISNULL(FGROUP,''),ISNULL(FNUM,0)," & _
//"ISNULL(FENTRYID,0),ISNULL(FEXP,''),ISNULL(FACCTID,''),ISNULL(FCLSNAME1,''),ISNULL(FOBJID1,''),ISNULL(FOBJNAME1,'')," & _
//"ISNULL(FCLSNAME2,0),ISNULL(FOBJID2,''),ISNULL(FOBJNAME2,'')," & _
//"ISNULL(FCLSNAME3,''),ISNULL(FOBJID3,''),ISNULL(FOBJNAME3,''),ISNULL(FCLSNAME4,'')," & _
//"ISNULL(FOBJID4,''),ISNULL(FOBJNAME4,''),ISNULL(FCLSNAME5,''),ISNULL(FOBJID5,''),ISNULL(FOBJNAME5,''),ISNULL(FCLSNAME6,''),ISNULL(FOBJID6,'')," & _
//"ISNULL(FOBJNAME6,''),ISNULL(FCLSNAME7,''),ISNULL(FOBJID7,''),ISNULL(FOBJNAME7,''),ISNULL(FCLSNAME8,''),ISNULL(FOBJID8,''),ISNULL(FOBJNAME8,'')," & _
//"ISNULL(FTRANSID,''),ISNULL(FCYID,''),ISNULL(FEXCHRATE,0),ISNULL(FDC,'')," & _
//"ISNULL(FFCYAMT,0),ISNULL(FQTY,0),ISNULL(FPRICE,0),ISNULL(FDEBIT,0),ISNULL(FCREDIT,0)," & _
//"ISNULL(FSETTLCODE,''),ISNULL(FSETTLENO,''),ISNULL(FPREPARE,''),ISNULL(FPOSTER,''),ISNULL(FCHECKER,''),ISNULL(FATTCHMENT,0)," & _
//"ISNULL(FPOSTED,0),ISNULL(FMODULE,''),ISNULL(FDELETED,0), ISNULL(FSERIALNO,0) " & _
// "FROM vp_CwjkVoucher WHERE " & sFilter & " AND BUGUID='" & Session("BUGUID") & "' AND CwztGUID='" & sCwztGUID & "' AND IsExport=0 ORDER BY FNUM,FENTRYID"
            //FDATE
            _FDATE =reader.GetDateTime(0);
            //FTRANSDATE
            _FTRANSDATE = reader.GetDateTime(1);
            //FPERIOD
            _FPERIOD = reader.GetInt32(2);
            //FGROUP
            _FGROUP =reader.GetString(3);
            //FNUM
            _FNUM =  reader.GetInt32(4);
            //FENTRYID 凭证分录号必须从0开始。
            _FENTRYID = reader.GetInt32(5);
            //FEXP
            _FEXP = reader.GetString(6) ;
            //FACCTID
            _FACCTID =reader.GetString(7) ;
            //FCLSNAME1
            _FCLSNAME1 =reader.GetString(8);
            //FOBJID1
            _FOBJID1 =  reader.GetString(9);
            //FOBJNAME1
            _FOBJNAME1 = reader.GetString(10);
            //FCLSNAME2
            _FCLSNAME2 = reader.GetString(11) ;
            //FOBJID2
            _FOBJID2 =reader.GetString(12);
            //FOBJNAME2
            _FOBJNAME2 =reader.GetString(13);
            //FCLSNAME3
            _FCLSNAME3 = reader.GetString(14);
            //FOBJID3
            _FOBJID3 = reader.GetString(15);
            //FOBJNAME3
            _FOBJNAME3 = reader.GetString(16);
            //FCLSNAME4
            _FCLSNAME4 = reader.GetString(17);
            //FOBJID4
            _FOBJID4 = reader.GetString(18);
            //FOBJNAME4
            _FOBJNAME4 =  reader.GetString(19) ;
            //FCLSNAME5
            _FCLSNAME5 =  reader.GetString(20);
            //FOBJID5
            _FOBJID5 =  reader.GetString(21);
            //FOBJNAME5
            _FOBJNAME5 = reader.GetString(22) ;
            //FCLSNAME6
            _FCLSNAME6 = reader.GetString(23);
            //FOBJID6
            _FOBJID6 = reader.GetString(24);
            //FOBJNAME6
            _FOBJNAME6 =  reader.GetString(25);
            //FCLSNAME7
            _FCLSNAME7 = reader.GetString(26);
            //FOBJID7
            _FOBJID7 =  reader.GetString(27);
            //FOBJNAME7
            _FOBJNAME7 = reader.GetString(28) ;
            //FCLSNAME8
            _FCLSNAME8 =  reader.GetString(29) ;
            //FOBJID8
            _FOBJID8=reader.GetString(30) ;
            //FOBJNAME8
            _FOBJNAME8 =reader.GetString(31) ;
            //FTRANSID
            _FTRANSID = reader.GetString(32) ;
            //FCYID
            _FCYID =  reader.GetString(33);
            //FEXCHRATE
            _FEXCHRATE =  reader.GetDecimal(34);
            //FDC
            _FDC =  reader[35].ToString();
            //FFCYAMT
            _FFCYAMT =reader.GetDecimal(36);
            //FQTY
            _FQTY =reader.GetDecimal(37);
            //FPRICE
            _FPRICE =reader.GetDecimal(38);
            //FDEBIT
            _FDEBIT =reader.GetDecimal(39);
            //FCREDIT
            //if(reader[40].GetType() != typeof(DBNull) )
            //{
                _FCREDIT = reader.GetDecimal(40);
            //}
            //else
            //{
            //    throw new Exception("FCREDIT应为数字");
            //}
            //FSETTLCODE
            _FSETTLCODE = reader.GetString(41) ;
            //FSETTLENO
            _FSETTLENO = reader.GetString(42);
            //FPREPARE
            _FPREPARE = reader.GetString(43);
            //FPOSTER
            _FPOSTER = reader.GetString(44);
            //FCHECKER
            _FCHECKER = reader.GetString(45);
            //FATTCHMENT
            _FATTCHMENT =  reader.GetInt32(46);
            //FPOSTED
            _FPOSTED =   reader.GetByte(47)==0?false:true ;
            //FMODULE
            _FMODULE = reader.GetString(48);
            //FDELETED
            _FDELETED = reader.GetByte(49)==0?false:true; 
            //FSERIALNO
            _FSERIALNO =  reader.GetInt32(50);


            //FPAY
            _FPAY = "";
            //FCASH
            _FCASH = "";
            //FUNITNAME
            _FUNITNAME = "";
            //FREFERENCE
            _FREFERENCE = "";
            //FCASHFLOW
            _FCASHFLOW = 0;
            //FHANDLER
            _FHANDLER = 0;
        }



        private DateTime _FDATE;
        [ExportAsDateColumn("FDATE")]
        public DateTime FDATE
        {
            get { return _FDATE; }
            set { _FDATE = value; }
        }

        private DateTime _FTRANSDATE;
        [ExportAsDateColumn("FTRANSDATE")]
        public DateTime FTRANSDATE
        {
            get { return _FTRANSDATE; }
            set { _FTRANSDATE = value; }
        }

        private decimal _FPERIOD;
        [ExportAsNumericColumn("FPERIOD", 20, 5)]
        public decimal FPERIOD
        {
            get { return _FPERIOD; }
            set { _FPERIOD = value; }
        }

        private string _FGROUP;
        [ExportAsCharacterColumn("FGROUP", 80)]
        public string FGROUP
        {
            get { return _FGROUP; }
            set { _FGROUP = value; }
        }

        private decimal _FNUM;
        [ExportAsNumericColumn("FNUM", 20, 5)]
        public decimal FNUM
        {
            get { return _FNUM; }
            set { _FNUM = value; }
        }

        private decimal _FENTRYID;
        [ExportAsNumericColumn("FENTRYID", 20, 5)]
        public decimal FENTRYID
        {
            get { return _FENTRYID; }
            set { _FENTRYID = value; }
        }

        private string _FEXP;
        [ExportAsCharacterColumn("FEXP", 254)]
        public string FEXP
        {
            get { return _FEXP; }
            set { _FEXP = value; }
        }

        private string _FACCTID;
        [ExportAsCharacterColumn("FACCTID", 40)]
        public string FACCTID
        {
            get { return _FACCTID; }
            set { _FACCTID = value; }
        }

        private string _FCLSNAME1;
        [ExportAsCharacterColumn("FCLSNAME1", 80)]
        public string FCLSNAME1
        {
            get { return _FCLSNAME1; }
            set { _FCLSNAME1 = value; }
        }

        private string _FOBJID1;
        [ExportAsCharacterColumn("FOBJID1", 80)]
        public string FOBJID1
        {
            get { return _FOBJID1; }
            set { _FOBJID1 = value; }
        }

        private string _FOBJNAME1;
        [ExportAsCharacterColumn("FOBJNAME1", 80)]
        public string FOBJNAME1
        {
            get { return _FOBJNAME1; }
            set { _FOBJNAME1 = value; }
        }

        private string _FCLSNAME2;
        [ExportAsCharacterColumn("FCLSNAME2", 80)]
        public string FCLSNAME2
        {
            get { return _FCLSNAME2; }
            set { _FCLSNAME2 = value; }
        }

        private string _FOBJID2;
        [ExportAsCharacterColumn("FOBJID2", 80)]
        public string FOBJID2
        {
            get { return _FOBJID2; }
            set { _FOBJID2 = value; }
        }

        private string _FOBJNAME2;
        [ExportAsCharacterColumn("FOBJNAME2", 80)]
        public string FOBJNAME2
        {
            get { return _FOBJNAME2; }
            set { _FOBJNAME2 = value; }
        }

        private string _FCLSNAME3;
        [ExportAsCharacterColumn("FCLSNAME3", 80)]
        public string FCLSNAME3
        {
            get { return _FCLSNAME3; }
            set { _FCLSNAME3 = value; }
        }

        private string _FOBJID3;
        [ExportAsCharacterColumn("FOBJID3", 80)]
        public string FOBJID3
        {
            get { return _FOBJID3; }
            set { _FOBJID3 = value; }
        }

        public string _FOBJNAME3;
        [ExportAsCharacterColumn("FOBJNAME3", 80)]
        public string FOBJNAME3
        {
            get { return _FOBJNAME3; }
            set { _FOBJNAME3 = value; }
        }

        public string _FCLSNAME4;
        [ExportAsCharacterColumn("FCLSNAME4", 80)]
        public string FCLSNAME4
        {
            get { return _FCLSNAME4; }
            set { _FCLSNAME4 = value; }
        }

        public string _FOBJID4;
        [ExportAsCharacterColumn("FOBJID4", 80)]
        public string FOBJID4
        {
            get { return _FOBJID4; }
            set { _FOBJID4 = value; }
        }

        public string _FOBJNAME4;
        [ExportAsCharacterColumn("FOBJNAME4", 80)]
        public string FOBJNAME4
        {
            get { return _FOBJNAME4; }
            set { _FOBJNAME4 = value; }
        }

        //
        public string _FCLSNAME5;
        [ExportAsCharacterColumn("FCLSNAME5", 80)]
        public string FCLSNAME5
        {
            get { return _FCLSNAME5; }
            set { _FCLSNAME5 = value; }
        }

        public string _FOBJID5;
        [ExportAsCharacterColumn("FOBJID5", 80)]
        public string FOBJID5
        {
            get { return _FOBJID5; }
            set { _FOBJID5 = value; }
        }

        public string _FOBJNAME5;
        [ExportAsCharacterColumn("FOBJNAME5", 80)]
        public string FOBJNAME5
        {
            get { return _FOBJNAME5; }
            set { _FOBJNAME5 = value; }
        }

        public string _FCLSNAME6;
        [ExportAsCharacterColumn("FCLSNAME6", 80)]
        public string FCLSNAME6
        {
            get { return _FCLSNAME6; }
            set { _FCLSNAME6 = value; }
        }

        public string _FOBJID6;
        [ExportAsCharacterColumn("FOBJID6", 80)]
        public string FOBJID6
        {
            get { return _FOBJID6; }
            set { _FOBJID6 = value; }
        }

        public string _FOBJNAME6;
        [ExportAsCharacterColumn("FOBJNAME6", 80)]
        public string FOBJNAME6
        {
            get { return _FOBJNAME6; }
            set { _FOBJNAME6 = value; }
        }

        public string _FCLSNAME7;
        [ExportAsCharacterColumn("FCLSNAME7", 80)]
        public string FCLSNAME7
        {
            get { return _FCLSNAME7; }
            set { _FCLSNAME7 = value; }
        }

        public string _FOBJID7;
        [ExportAsCharacterColumn("FOBJID7", 80)]
        public string FOBJID7
        {
            get { return _FOBJID7; }
            set { _FOBJID7 = value; }
        }

        public string _FOBJNAME7;
        [ExportAsCharacterColumn("FOBJNAME7", 80)]
        public string FOBJNAME7
        {
            get { return _FOBJNAME7; }
            set { _FOBJNAME7 = value; }
        }


        public string _FCLSNAME8;
        [ExportAsCharacterColumn("FCLSNAME8", 80)]
        public string FCLSNAME8
        {
            get { return _FCLSNAME8; }
            set { _FCLSNAME8 = value; }
        }

        public string _FOBJID8;
        [ExportAsCharacterColumn("FOBJID8", 80)]
        public string FOBJID8
        {
            get { return _FOBJID8; }
            set { _FOBJID8 = value; }
        }

        public string _FOBJNAME8;
        [ExportAsCharacterColumn("FOBJNAME8", 80)]
        public string FOBJNAME8
        {
            get { return _FOBJNAME8; }
            set { _FOBJNAME8 = value; }
        }



        //FDES FTRANSID	FCYID	FEXCHRATE	FDC	FFCYAMT	FQTY	FPRICE	FDEBIT	

        //public string _FDES;
        //[ExportAsCharacterColumn("FDES", 254)]
        //public string FDES
        //{
        //    get { return _FDES; }
        //    set { _FDES = value; }
        //}

        private string _FTRANSID;
        [ExportAsCharacterColumn("FTRANSID", 80)]
        public string FTRANSID
        {
            get { return _FTRANSID; }
            set { _FTRANSID = value; }
        }

        private string _FCYID;
        [ExportAsCharacterColumn("FCYID", 10)]
        public string FCYID
        {
            get { return _FCYID; }
            set { _FCYID = value; }
        }

        private decimal _FEXCHRATE;
        [ExportAsNumericColumn("FEXCHRATE", 20, 5)]
        public decimal FEXCHRATE
        {
            get { return _FEXCHRATE; }
            set { _FEXCHRATE = value; }
        }

        private string _FDC;
        [ExportAsCharacterColumn("FDC", 1)]
        public string FDC
        {
            get { return _FDC; }
            set { _FDC = value; }
        }

        private decimal _FFCYAMT;
        [ExportAsNumericColumn("FFCYAMT", 20, 5)]
        public decimal FFCYAMT
        {
            get { return _FFCYAMT; }
            set { _FFCYAMT = value; }
        }

        private decimal _FQTY;
        [ExportAsNumericColumn("FQTY", 20, 5)]
        public decimal FQTY
        {
            get { return _FQTY; }
            set { _FQTY = value; }
        }

        private decimal _FPRICE;
        [ExportAsNumericColumn("FPRICE", 20, 5)]
        public decimal FPRICE
        {
            get { return _FPRICE; }
            set { _FPRICE = value; }
        }

        private decimal _FDEBIT;
        [ExportAsNumericColumn("FDEBIT", 20, 5)]
        public decimal FDEBIT
        {
            get { return _FDEBIT; }
            set { _FDEBIT = value; }
        }

        //FCREDIT	FSETTLCODE	FSETTLENO	FPREPARE	FPAY	FCASH	FPOSTER	FCHECKER	
        private decimal _FCREDIT;
        [ExportAsNumericColumn("FCREDIT", 20, 5)]
        public decimal FCREDIT
        {
            get { return _FCREDIT; }
            set { _FCREDIT = value; }
        }

        private string _FSETTLCODE;
        [ExportAsCharacterColumn("FSETTLCODE", 80)]
        public string FSETTLCODE
        {
            get { return _FSETTLCODE; }
            set { _FSETTLCODE = value; }
        }

        private string _FSETTLENO;
        [ExportAsCharacterColumn("FSETTLENO", 40)]
        public string FSETTLENO
        {
            get { return _FSETTLENO; }
            set { _FSETTLENO = value; }
        }

        private string _FPREPARE;
        [ExportAsCharacterColumn("FPREPARE", 80)]
        public string FPREPARE
        {
            get { return _FPREPARE; }
            set { _FPREPARE = value; }
        }

        private string _FPAY;
        [ExportAsCharacterColumn("FPAY", 80)]
        public string FPAY
        {
            get { return _FPAY; }
            set { _FPAY = value; }
        }

        private string _FCASH;
        [ExportAsCharacterColumn("FCASH", 80)]
        public string FCASH
        {
            get { return _FCASH; }
            set { _FCASH = value; }
        }

        public string _FPOSTER;
        [ExportAsCharacterColumn("FPOSTER", 80)]
        public string FPOSTER
        {
            get { return _FPOSTER; }
            set { _FPOSTER = value; }
        }

        public string _FCHECKER;
        [ExportAsCharacterColumn("FCHECKER", 80)]
        public string FCHECKER
        {
            get { return _FCHECKER; }
            set { _FCHECKER = value; }
        }

        //FATTCHMENT FPOSTED FMODULE FDELETED FSERIALNO	FUNITNAME FREFERENCE FCASHFLOW
        public decimal _FATTCHMENT;
        [ExportAsNumericColumn("FATTCHMENT", 20, 5)]
        public decimal FATTCHMENT
        {
            get { return _FATTCHMENT; }
            set { _FATTCHMENT = value; }
        }

        public bool _FPOSTED;
        [ExportAsLogicalColumn("FPOSTED")]
        public bool FPOSTED
        {
            get { return _FPOSTED; }
            set { _FPOSTED = value; }
        }

        public string _FMODULE;
        [ExportAsCharacterColumn("FMODULE", 10)]
        public string FMODULE
        {
            get { return _FMODULE; }
            set { _FMODULE = value; }
        }

        public bool _FDELETED;
        [ExportAsLogicalColumn("FDELETED")]
        public bool FDELETED
        {
            get { return _FDELETED; }
            set { _FDELETED = value; }
        }

        public decimal _FSERIALNO;
        [ExportAsNumericColumn("FSERIALNO", 20, 5)]
        public decimal FSERIALNO
        {
            get { return _FSERIALNO; }
            set { _FSERIALNO = value; }
        }

        public string _FUNITNAME;
        [ExportAsCharacterColumn("FUNITNAME", 80)]
        public string FUNITNAME
        {
            get { return _FUNITNAME; }
            set { _FUNITNAME = value; }
        }

        public string _FREFERENCE;
        [ExportAsCharacterColumn("FREFERENCE", 254)]
        public string FREFERENCE
        {
            get { return _FREFERENCE; }
            set { _FREFERENCE = value; }
        }

        public decimal _FCASHFLOW;
        [ExportAsNumericColumn("FCASHFLOW", 20, 5)]
        public decimal FCASHFLOW
        {
            get { return _FCASHFLOW; }
            set { _FCASHFLOW = value; }
        }

        public decimal _FHANDLER;
        [ExportAsNumericColumn("FHANDLER", 20, 5)]
        public decimal FHANDLER
        {
            get { return _FHANDLER; }
            set { _FHANDLER = value; }
        }
    }
}
